package cn.edu.abtu.controller;

import cn.edu.abtu.entity.EduComment;
import cn.edu.abtu.service.EduCommentService;
import cn.edu.abtu.vo.ResponseData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/eduservice/comment")
public class EduCommentController {


    @Resource
    private EduCommentService eduCommentService;


    @PostMapping("/addComment")
    public ResponseData add(@RequestBody EduComment eduComment, HttpServletRequest request) {
        return eduCommentService.add(eduComment,request);
    }

    @GetMapping("/page/{page}/{limit}")
    public ResponseData page(@PathVariable Integer page,
                             @PathVariable Integer limit,
                             @RequestParam("courseId") String courseId){
        return eduCommentService.page(page,limit,courseId);
    }

}

